import 'package:regular_assess/helper/utils/ifly/record.dart';

import '../util.dart';
import 'ifly_dialog.dart';

class IFlyUtil {
  static final IFlyUtil instance = IFlyUtil._interval();
  factory IFlyUtil() => instance;
  IFlyUtil._interval();

  final record = RecordMan();

  // ignore: non_constant_identifier_names
  Future<RecordResult> ifly_audio() async {
    // record.dec();
    RecordResult? result = await Get.bottomSheet(
      IflyDialog(
        man: record,
      ),
      isScrollControlled: false,
      isDismissible: false,
      enableDrag: true,
    );
    if (result == null) {
      var res = await record.cancel();
      Get.log(res.json);
      return res;
    }
    if (result.status == -1) {
      var res = await record.stop();
      Get.log(res.json);
      return res;
    }
    Get.log(result.json);
    return result;
  }
}
